<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DealController
 *
 * @author bom
 */
class Cms_DealController extends My_Controller_Action {

    //put your code here
    public function init() {

        parent::init();
    }

    public function testAction(){
        $deal_id = $this->_request->getParam('deal_id');
        $model = $this->loadModel('cms','Deal');
        $count = $model->countUser($deal_id);
        echo $count;
        exit;
    }

    public function getuserAction() {
        $deal_id = $this->_request->getParam('deal_id');
        $offset = $this->_request->getParam('offset');
        $count = $this->_request->getParam('count');
        $model = $this->loadModel('cms','CmsDeal');
        $users = $model->getUser($deal_id,$offset,$count);
        $str = "";
        if (count($users) > 0) {
            foreach ($users as $user) {
                $str .= '<li><img src="'.$this->view->baseUrl('public/images/user.png').'" style="margin: 0 5px;" alt=""/>'.$user->fullname.'</li>';
            }
        }
        echo $str;
        exit;
    }
}

?>
